import VueRouter from "vue-router";
import Vue from "vue";
//引入组件
import MyAbout from "@/views/MyAbout.vue";
import MyHome from "@/views/MyHome.vue";
import NotFind from '@/views/NotFind.vue';
import MyPage1 from '../views/MyPage1.vue';
import MyPage2 from '../views/MyPage2.vue';

Vue.use(VueRouter);

const router = new VueRouter({
  routes: [{
      path: "/",
      redirect: '/MyHome'
    },
    {
      path: "/MyHome",
      component: MyHome,
      children: [{
          path: 'MyPage1',
          component: MyPage1
        },
        {
          path: 'MyPage2',
          component: MyPage2
        }
      ]
    },
    {
      path: "/MyAbout",
      component: MyAbout
    },
    {
      name: "MyPage1",
      path: "/MyPage1/:id",
      component: MyPage1
    },
    {
      name: "MyPage2",
      path: "/MyPage2",
      component: MyPage2
    },
    {
      path: "*",
      component: NotFind
    }
  ],
});

export default router;